<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 */

class Modules_News_Widgets_Olderarticle_Widget extends Gio_Core_Widget
{
	public function showAction()
	{
		$request = $this->getRequest();
		$limit = $this->getParam('limit', 5);
		$categoryId = $this->getParam('category_id');
		$articleId = $this->getParam('article_id');
		$article = Modules_News_Services_Article::getById($articleId, true);
		
		$articles = Modules_News_Services_Article::getOlderArticles($article, $limit, $categoryId);
		$this->view->articles = $articles;
	}
	
	public function configAction()
	{
		$limit = $this->getParam('limit', 5);
		$this->view->limit = $limit;
		
		$this->view->moduleName = Gio_Core_Widget::getIntance()->getModuleName();
		$this->view->widgetName = Gio_Core_Widget::getIntance()->getWidgetName();
		$this->view->widgetIndex = $this->getParam('widget_index');
	}
}